<?php


namespace app\api\controller;


use think\Controller;
use think\Db;
use think\Request;

class WorldUser extends Controller
{
    public function register(){
        $request = Request::instance();
        $data = $request->param();
//        return $data;
////        一条数据条件查询
//        Db::name("t_user")->where(["name" => $data ["name","password" => $data["password"]])->find();
//        Db::name("t_user")->select();
        $insert_data = [
        "name" => $data["name"],
        "password" => $data["password"]
            ];
//        Db::name("t_user")->insert($insert_data);
      $userid = Db::name("t_user")->insertGetId($insert_data);
      $userinfo = Db::name("t_user")->where(["id"=> $userid])->find();

        $result = [
            "code" => 288,
            "msg" => "注册成功",
            "data" => $userinfo
        ];
        return $result;
    }

}